package com.lxz.ob_hore;

import com.lxz.ob_hore.heros.AnQi;
import com.lxz.ob_hore.heros.Armor;
import com.lxz.ob_hore.heros.IHero;
import com.lxz.ob_hore.heros.Luban;
import com.lxz.ob_hore.talentskills.*;

import java.util.ArrayList;
import java.util.Scanner;


public class Main {
    public void init() {
        ArrayList<IHero> listHero = new ArrayList<>();
        listHero.add(new Armor());
        listHero.add(new AnQi());
        listHero.add(new Luban());
        ArrayList<ITalentSkill> listTalent = new ArrayList<>();
        listTalent.add(new Beheaded());
        listTalent.add(new Cleanse());
        listTalent.add(new Flash());
        listTalent.add(new Rage());
        listTalent.add(new Sprint());
        selectAllHero(listHero, listTalent);

    }

    public void selectAllHero(ArrayList<IHero> listHero, ArrayList<ITalentSkill> listTalent) {
        System.out.println("==================== 请选择英雄 ====================");
        for (int i = 0; i < listHero.size(); i++) {
            System.out.println(">> " + (i + 1) + " --> " + listHero.get(i).getHeroName());
        }
        System.out.println("==================== 请选择英雄 ====================");
        Scanner sc = new Scanner(System.in);
        int seq = sc.nextInt();
        System.out.println("你选择了" + listHero.get(seq - 1).getHeroName());
        selectAllTalentSkill(listHero.get(seq - 1), listTalent);
    }


    public void selectAllTalentSkill(IHero hero, ArrayList<ITalentSkill> list) {
        System.out.println("==================== 请选择天赋技能==================== ");
        for (int i = 0; i < list.size(); i++) {
            System.out.println(">> " + (i + 1) + " --> " + list.get(i).getTalentSkill());
        }
        System.out.println("==================== 请选择天赋技能==================== ");
        Scanner sc = new Scanner(System.in);
        int seq = sc.nextInt();
        getSkill(list, seq - 1, hero);
    }

    public void getSkill(ArrayList<ITalentSkill> list, int index, IHero hero) {
        hero.setTalentSkill(list.get(index));
        hero.oneSkill();
        hero.twoSkill();
        hero.threeSkill();
        hero.talentSkill();
    }

    public static void main(String[] args) {
        Main m = new Main();
        m.init();
    }
}
